<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0"><script src="https://unpkg.com/vue@next"></script>
    <title>Document</title>
</head>
<body>
    <div id="app">
        <p v-if="isActive">v-if  true</p>
        <p v-else> v-else  false</p>
        <p v-show="isActive">v-show </p>
        <button @click="switchAction">切换状态</button>

        <p v-if="num==0">num 为 0</p>
        <p v-else-if="num==1">num 为 1</p>
        <p v-else> num 非0非1</p>
        <button @click="changeNum(0)">num 为 0</button>
        <button @click="changeNum(1)">num 为 1</button>
        <button @click="changeNum(2)">num 非 0 非 1</button>
    </div>
    <script>
        const app = Vue.createApp({
            data(){
                return{
                    isActive: true,
                    num: 0
                }
            },
            methods: {
                switchAction(){
                   this.isActive=!this.isActive;
                   console.log('this.isActive',this.isActive)
                },
                changeNum(number){
                    this.num = number;
                }
            }
            
        }).mount("#app")
    </script>
</body>
</html>